<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>emacps: xemacps_example_intr_dma.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="HTML_custom.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="xlogo_bg.gif"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">emacps
   </div>
   <div id="projectbrief">Xilinx SDK Drivers API Documentation</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',false,false,'search.php','Search');
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('xemacps__example__intr__dma_8c.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">xemacps_example_intr_dma.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Overview</h2>
<div class="textblock"><p>Implements examples that utilize the EmacPs's interrupt driven DMA packet transfer mode to send and receive frames. </p>
<p>These examples demonstrate:</p>
<ul>
<li>How to perform simple send and receive.</li>
<li>Interrupt</li>
<li>Error handling</li>
<li>Device reset</li>
</ul>
<p>Functional guide to example:</p>
<ul>
<li>EmacPsDmaSingleFrameIntrExample demonstrates the simplest way to send and receive frames in in interrupt driven DMA mode.</li>
<li>EmacPsErrorHandler() demonstrates how to manage asynchronous errors.</li>
<li>EmacPsResetDevice() demonstrates how to reset the driver/HW without loosing all configuration settings.</li>
</ul>
<pre>
MODIFICATION HISTORY:</pre><pre>Ver   Who  Date     Changes
<hr/>

1.00a wsy  01/10/10 First release
1.00a asa  11/25/11 The cache disable routines are removed. So now both
              I-cache and D-cache are enabled. The array RxBuffer is
              removed to avoid an extra copy from RxBuffer to RxFrame.
              Now the address of RxFrame is submitted to the Rx BD
              instead of the address of RxBuffer.
              In function EmacPsDmaSingleFrameIntrExample, BdRxPtr
              is made as a pointer instead of array of pointers. This
              is done since on the Rx path we now submit a single BD
              instead of all 32 BDs. Because of this change, relevant
              changes are made throughout the function
              EmacPsDmaSingleFrameIntrExample.
              Cache invalidation is now being done for the RxFrame
              buffer.
              The unnecessary cache flush (Xil_DCacheFlushRange) is
              removed. This was being done towards the end of the
              example which was unnecessary.
1.00a asa 01/24/12  Support for Zynq board is added. The SLCR divisors are
                      different for Zynq. Changes are made for the same.
                      Presently the SLCR GEM clock divisors are hard-coded
              assuming that IO PLL output frequency is 1000 MHz.
                      The BDs are allocated at the address 0xFF00000 and the
                      1 MB address range starting from this address is made
                      uncached. This is because, for GEM the BDs need to be
                      placed in uncached memory. The RX BDs are allocated at
                      address 0xFF00000 and TX BDs are allocated at address
                      0xFF10000.
                      The MDIO divisor used of 224 is used for Zynq board.
1.01a asa 02/27/12  The hardcoded SLCR divisors for Zynq are removed. The
              divisors are obtained from xparameters.h.c. The sleep
              values are reduced for Zynq. One sleep is added after
              MDIO divisor is set. Some of the prints are removed.
1.01a asa 03/14/12  The SLCR divisor support for ENET1 is added.
1.01a asa 04/15/12  The funcation calls to Xil_DisableMMU and Xil_EnableMMU
              are removed for setting the translation table
              attributes for the BD memory region.
1.05a asa 09/22/13 Cache handling is changed to fix an issue (CR#663885).
                  The cache invalidation of the Rx frame is now moved to
                  XEmacPsRecvHandler so that invalidation happens after the
                  received data is available in the memory. The variable
                  TxFrameLength is now made global.
2.1     srt 07/11/14 Implemented 64-bit changes and modified as per
              Zynq Ultrascale Mp GEM specification
3.0  kpc  01/23/14 Removed PEEP board related code
3.0  hk   03/18/15 Added support for jumbo frames.
                   Add cache flush after BD terminate entries.
3.2  hk   10/15/15 Added clock control using CRL_APB_GEM_REF_CTRL register.
                   Enabled 1G speed for ZynqMP GEM.
                   Select GEM interrupt based on instance present.
                   Manage differences between emulation platform and silicon.
3.2  mus  20/02/16.Added support for INTC interrupt controlller.
                   Added support to access zynq emacps interrupt from
                   microblaze.
3.3 kpc   12/09/16 Fixed issue when -O2 is enabled
3.4 ms    01/23/17 Modified xil_printf statement in main function to
                  ensure that "Successfully ran" and "Failed" strings
                  are available in all examples. This is a fix for
                  CR-965028.
</pre> </div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a738f765e013d4796d1a2cc7e9509d063"><td class="memItemLeft" align="right" valign="top">LONG&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xemacps__example__intr__dma_8c.html#a738f765e013d4796d1a2cc7e9509d063">EmacPsDmaIntrExample</a> (INTC *IntcInstancePtr, <a class="el" href="group__emacps__v3__1.html#ga7510da8ed2cb292c5abdbcc18cc26c67">XEmacPs</a> *EmacPsInstancePtr, u16 EmacPsDeviceId, u16 EmacPsIntrId)</td></tr>
<tr class="memdesc:a738f765e013d4796d1a2cc7e9509d063"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function demonstrates the usage of the EmacPs driver by sending by sending and receiving frames in interrupt driven DMA mode.  <a href="#a738f765e013d4796d1a2cc7e9509d063">More...</a><br /></td></tr>
<tr class="separator:a738f765e013d4796d1a2cc7e9509d063"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afc51dc7c75ee83293bdc425f414e8ac0"><td class="memItemLeft" align="right" valign="top">LONG&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xemacps__example__intr__dma_8c.html#afc51dc7c75ee83293bdc425f414e8ac0">EmacPsDmaSingleFrameIntrExample</a> (<a class="el" href="group__emacps__v3__1.html#ga7510da8ed2cb292c5abdbcc18cc26c67">XEmacPs</a> *EmacPsInstancePtr)</td></tr>
<tr class="memdesc:afc51dc7c75ee83293bdc425f414e8ac0"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function demonstrates the usage of the EMACPS by sending and receiving a single frame in DMA interrupt mode.  <a href="#afc51dc7c75ee83293bdc425f414e8ac0">More...</a><br /></td></tr>
<tr class="separator:afc51dc7c75ee83293bdc425f414e8ac0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a938f994841cac409516f536c1f5ab844"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xemacps__example__intr__dma_8c.html#a938f994841cac409516f536c1f5ab844">XEmacPsClkSetup</a> (<a class="el" href="group__emacps__v3__1.html#ga7510da8ed2cb292c5abdbcc18cc26c67">XEmacPs</a> *EmacPsInstancePtr, u16 EmacPsIntrId)</td></tr>
<tr class="memdesc:a938f994841cac409516f536c1f5ab844"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function sets up the clock divisors for 1000Mbps.  <a href="#a938f994841cac409516f536c1f5ab844">More...</a><br /></td></tr>
<tr class="separator:a938f994841cac409516f536c1f5ab844"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga5d0b4b9258cdead2c0875a0853c087b3"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__emacps__v3__1.html#ga5d0b4b9258cdead2c0875a0853c087b3">XEmacPs_SetMdioDivisor</a> (<a class="el" href="group__emacps__v3__1.html#ga7510da8ed2cb292c5abdbcc18cc26c67">XEmacPs</a> *InstancePtr, XEmacPs_MdcDiv Divisor)</td></tr>
<tr class="memdesc:ga5d0b4b9258cdead2c0875a0853c087b3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the MDIO clock divisor.  <a href="group__emacps__v3__1.html#ga5d0b4b9258cdead2c0875a0853c087b3">More...</a><br /></td></tr>
<tr class="separator:ga5d0b4b9258cdead2c0875a0853c087b3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a840291bc02cba5474a4cb46a9b9566fe"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xemacps__example__intr__dma_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main</a> (void)</td></tr>
<tr class="memdesc:a840291bc02cba5474a4cb46a9b9566fe"><td class="mdescLeft">&#160;</td><td class="mdescRight">This is the main function for the EmacPs example.  <a href="#a840291bc02cba5474a4cb46a9b9566fe">More...</a><br /></td></tr>
<tr class="separator:a840291bc02cba5474a4cb46a9b9566fe"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="a738f765e013d4796d1a2cc7e9509d063"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a738f765e013d4796d1a2cc7e9509d063">&#9670;&nbsp;</a></span>EmacPsDmaIntrExample()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">LONG EmacPsDmaIntrExample </td>
          <td>(</td>
          <td class="paramtype">INTC *&#160;</td>
          <td class="paramname"><em>IntcInstancePtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__emacps__v3__1.html#ga7510da8ed2cb292c5abdbcc18cc26c67">XEmacPs</a> *&#160;</td>
          <td class="paramname"><em>EmacPsInstancePtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u16&#160;</td>
          <td class="paramname"><em>EmacPsDeviceId</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u16&#160;</td>
          <td class="paramname"><em>EmacPsIntrId</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function demonstrates the usage of the EmacPs driver by sending by sending and receiving frames in interrupt driven DMA mode. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">IntcInstancePtr</td><td>is a pointer to the instance of the Intc driver. </td></tr>
    <tr><td class="paramname">EmacPsInstancePtr</td><td>is a pointer to the instance of the EmacPs driver. </td></tr>
    <tr><td class="paramname">EmacPsDeviceId</td><td>is Device ID of the EmacPs Device , typically XPAR_&lt;EMACPS_instance&gt;_DEVICE_ID value from xparameters.h. </td></tr>
    <tr><td class="paramname">EmacPsIntrId</td><td>is the Interrupt ID and is typically XPAR_&lt;EMACPS_instance&gt;_INTR value from xparameters.h.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS to indicate success, otherwise XST_FAILURE.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p class="reference">Referenced by <a class="el" href="xemacps__example__intr__dma_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main()</a>.</p>

</div>
</div>
<a id="afc51dc7c75ee83293bdc425f414e8ac0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afc51dc7c75ee83293bdc425f414e8ac0">&#9670;&nbsp;</a></span>EmacPsDmaSingleFrameIntrExample()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">LONG EmacPsDmaSingleFrameIntrExample </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__emacps__v3__1.html#ga7510da8ed2cb292c5abdbcc18cc26c67">XEmacPs</a> *&#160;</td>
          <td class="paramname"><em>EmacPsInstancePtr</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function demonstrates the usage of the EMACPS by sending and receiving a single frame in DMA interrupt mode. </p>
<p>The source packet will be described by two descriptors. It will be received into a buffer described by a single descriptor.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">EmacPsInstancePtr</td><td>is a pointer to the instance of the EmacPs driver.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS to indicate success, otherwise XST_FAILURE.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

</div>
</div>
<a id="a840291bc02cba5474a4cb46a9b9566fe"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a840291bc02cba5474a4cb46a9b9566fe">&#9670;&nbsp;</a></span>main()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int main </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This is the main function for the EmacPs example. </p>
<p>This function is not included if the example is generated from the TestAppGen test tool.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">None.</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS to indicate success, otherwise XST_FAILURE.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p class="reference">References <a class="el" href="xemacps__example__intr__dma_8c.html#a738f765e013d4796d1a2cc7e9509d063">EmacPsDmaIntrExample()</a>.</p>

</div>
</div>
<a id="a938f994841cac409516f536c1f5ab844"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a938f994841cac409516f536c1f5ab844">&#9670;&nbsp;</a></span>XEmacPsClkSetup()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void XEmacPsClkSetup </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__emacps__v3__1.html#ga7510da8ed2cb292c5abdbcc18cc26c67">XEmacPs</a> *&#160;</td>
          <td class="paramname"><em>EmacPsInstancePtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u16&#160;</td>
          <td class="paramname"><em>EmacPsIntrId</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function sets up the clock divisors for 1000Mbps. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">EmacPsInstancePtr</td><td>is a pointer to the instance of the EmacPs driver. </td></tr>
    <tr><td class="paramname">EmacPsIntrId</td><td>is the Interrupt ID and is typically XPAR_&lt;EMACPS_instance&gt;_INTR value from xparameters.h. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Copyright &copy; 2015 Xilinx Inc. All rights reserved.</li>
  </ul>
</div>
</body>
</html>
